import rootReducer from '../reducers';
import thunk from 'redux-thunk';
import {applyMiddleware, createStore} from 'redux';


let createLogger,logger,middleware

if (process.env.NODE_ENV === `development`) {
    createLogger = require(`redux-logger`);
    logger = createLogger();
    middleware = applyMiddleware(thunk,logger);
}else{
    middleware = applyMiddleware(thunk);
}


const store = createStore(
    rootReducer,
    middleware
)

export default store;
